home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Belgian Amiga Club - ADF Collection
/
BS1 part 34.zip
/
BS1 part 34
/
FredFish PD 314.adf
/
Zc
/
zcsrc.lzh
/
IOLib
/
stdio
/
fclose.c
< prev
next >
Wrap
C/C++ Source or Header
|
1989-05-14
|
450b
|
24 lines
#include <stdio.h>
int fclose(fp)
register FILE *fp;
{
register int f;
if(fp == NULL)
return(EOF); /* NULL file pointer file */
f = fp->_flag;
if((f & (_IOREAD | _IOWRT)) == 0)
return(EOF); /* file not open! */
fflush(fp);
if(fp->_bsiz != BUFSIZ) /* throw away non-standard buffer */
{
fp->_base = NULL;
fp->_ptr = NULL;
fp->_bsiz = 0;
}
fp->_flag = 0; /* clear status */
f = close(fp->_file);
return(f ? EOF : 0);
}